<form class="form-vertical" name="scheduleConfigForm"  novalidate>
    <div class="alert {{alerttype}} col-xs-12" ng-show="sucShow">
        <button type="button" class="close" data-dismiss="alert">
            <i class="icon-remove"></i>
        </button>
        <strong>{{sucMsg}}</strong>
    </div>
    <div class="col-xs-12  col-sm-12">
        <h4 class="header smaller lighter blue">
            <span>
                <strong>调度配置信息</strong>
            </span>
        </h4>
    </div>
    <div class="col-xs-12 text-center" ng-show="Loading">
        <div class="loading" style="color: #000000;width: auto">{{LoadingMsg}}</div>
    </div>
    <div class="col-xs-12  col-sm-1"></div>
    <div class="col-xs-12">
        <div class="col-xs-12 form-group">

            <label class="col-sm-1 control-label padding0 textRight">任务类型</label>

            <div class="col-sm-3">
                <select class="width-80" ng-model="conf_task_type">
                    <option value="transfer">脚本传输作业（3）</option>
                    <option value="calculate">脚本计算作业（4）</option>
                    <option value="common">其他通用作业（5）</option>
                </select>

            </div>

            <div ng-show="conf_task_type=='calculate'">
                <label class="col-sm-1 control-label textRight">目标库名</label>
                <div class="col-sm-3">
                <span class="block input-icon input-icon-right">
					<input type="text"
                           class="width-80" ng-model="conf_db_name">
			    </span>
                </div>
            </div>

            <div ng-show="conf_task_type=='transfer'">
                <label class="col-sm-1 control-label textRight">源介质</label>

                <div class="col-sm-3">
                    <select class="width-80" ng-model="conf_src">
                        <option value="hive">hive</option>
                        <option value="mysql">mysql</option>
                        <option value="sqlserver">sqlserver</option>
                    </select>
                </div>
            </div>
            <div ng-show="conf_task_type=='transfer'">
                <label class="col-sm-1 control-label textRight">目标介质</label>

                <div class="col-sm-3">
                    <select class="width-80" ng-model="conf_target">
                        <option value="hive">hive</option>
                        <option value="mysql">mysql</option>
                        <option value="sqlserver">sqlserver</option>
                    </select>

                </div>
            </div>
        </div>
        <p class="text-primary">* 1传输，2计算，3脚本传输作业，4脚本计算作业，5其他通用作业</p>
        <div class="col-xs-12 form-group"
             ng-show="conf_task_type=='transfer'||conf_task_type=='calculate'">

            <div>
                <label class="col-sm-1 control-label textRight">目标表名</label>

                <div class="col-sm-3">
                <span class="block input-icon input-icon-right">
					<input type="text"
                           class="width-80" ng-model="conf_table_name">
			    </span>
                </div>
            </div>
        </div>
        <div class="col-xs-12 form-group">

            <label class="col-sm-1 control-label padding0 textRight">任务名称</label>

            <div class="col-sm-3">
                <input type="text" class="width-80" ng-model="conf_taskName"
                       ng-change="checkTaskName()" ng-trim="true">
            </div>

            <label class="col-sm-1 control-label textRight">开发者</label>

            <div class="col-sm-3">
                <span class="block input-icon input-icon-right">
					<select ng-model="conf_developer"
                            id="form-field-select-1" class="width-80"
                            ng-options="dev as dev.cnName for dev in developerOptions">

                    </select>

			    </span>
            </div>

            <label class="col-sm-1 control-label padding0 textRight">执行频率</label>

            <div class="col-sm-3">
                <input type="text" class="width-80" name="freq" ng-model="conf_frequency">
                <button class="help-button" tooltip-placement="top" tooltip="具体写法请点击" ng-click="frequencyHelp()">?
                </button>
            </div>
        </div>


        <div class="col-xs-12 form-group">
            <label class="col-sm-1 control-label padding0 textRight">任务组</label>

            <div class="col-sm-3">
                <select name="taskGroup" class="width-80" ng-model="conf_taskGroup" ng-change="setDefaultFreq()"
                        ng-options="group.ID as group.Text for group in taskGroupOptions">
                </select>
            </div>

            <label class="col-sm-1 control-label padding0 textRight">周期</label>

            <div class="col-sm-3">
                <select name="taskCycle" class="width-80" ng-model="conf_cycle" ng-change="cycleChanged()"
                        ng-options="k as v for (k,v) in cycleOptions">
                </select>
            </div>


            <label class="col-sm-1 control-label padding0 textRight">优先级</label>

            <div class="col-sm-3">
                <select name="taskPriority" class="width-80" ng-model="conf_priority"
                        ng-options="priority.ID as priority.Text for priority in priorityOptions">
                </select>
            </div>
        </div>

        <div class="col-xs-12 form-group">
            <label class="col-sm-1 control-label padding0 textRight">失败重跑</label>

            <div class="col-sm-3">
                <select name="recall" class="width-80" ng-model="conf_ifRecall"
                        ng-options="ifRecall.ID as ifRecall.Text for ifRecall in ifRecallOptions"></select>
                </select>
            </div>

            <label class="col-sm-1 control-label padding0 textRight">重跑次数上限</label>

            <div class="col-sm-3">
                <select name="recallLimit" class="width-80" ng-model="conf_recallLimit"
                        ng-options="recallLimit for recallLimit in recallLimitOptions">
                </select>
            </div>

            <label class="col-sm-1 control-label padding0 textRight">失败重跑间隔</label>

            <div class="col-sm-3">
                <select name="recallInterval" class="width-80" ng-model="conf_recallInterval"
                        ng-options="recallInterval.ID as recallInterval.Text for recallInterval in recallIntervalOptions"></select>
                </select>
            </div>
        </div>

        <div class="col-xs-12 form-group">

            <label class="col-sm-1 control-label padding0 textRight">成功返回值</label>

            <div class="col-sm-3">
                <input type="text" class="width-80" ng-model="conf_successCode" ng-trim="true">
                <strong>*</strong>
            </div>

            <label class="col-sm-1 control-label padding0 textRight">等待返回码</label>

            <div class="col-sm-3">
                <input type="text" class="width-80" ng-model="conf_waitCode" ng-trim="true">
            </div>

            <label class="col-sm-1 control-label padding0 textRight">偏移量</label>

            <div class="col-sm-3">
                <select class="width-80" name="taskPeriod" ng-model="conf_offset"
                        ng-options="offset for offset in offsetOptions">
                </select>
                <span class="help-button" tooltip-placement="top"
                      tooltip="D：天级偏移，M：月级偏移，字母后的数字表示具体的偏移值，D0：不偏移，D1：向前偏移一天，M2：向前偏移两月">?</span>
            </div>

        </div>

        <div class="col-xs-12 form-group">

            <label class="col-sm-1 control-label padding0 textRight"
                    >超时时间</label>

            <div class="col-sm-3">
                <select class="width-80" name="taskTimeout" ng-model="conf_timeout"
                        ng-options="timeout.ID as timeout.Text for timeout in timeoutOptions" required>
                </select>
                <span class="help-button" tooltip-placement="top"
                      tooltip="当任务执行时间超过指定时间后，调度置其状态为timeout">?</span>
            </div>

            <label class="col-sm-1 control-label padding0 textRight">执行命令</label>

            <div class="col-sm-4">
                <input type="text" class="width-100" ng-model="conf_para1" ng-trim="true">
            </div>

            <label class="col-sm-1 control-label padding0 textRight">时间替换符</label>
            <div class="col-sm-1">
                 <select  ng-model="time_pattern" ng-change="setCommandTime()" class="width-100"
                         ng-options="ele.v as ele.name for ele in timePatternOptions">
                 </select>
            </div>
            <div class="col-sm-1"><a class="btn btn-link" href="http://192.168.100.106:8090/pages/viewpage.action?pageId=327990" target="_blank">帮助</a> </div>
        </div>
    </div>

    <div class="col-xs-12  col-sm-12">
        <h4 class="header smaller lighter blue">
                                        <span> <strong>调度依赖信息</strong>
                                        </span>
        </h4>
    </div>
    <div class="col-xs-12  col-sm-1"></div>

    <div class="col-xs-12" style="padding-bottom: 20px">
        <div class="col-xs-12 width-100">
            <div class="table-header">前驱依赖</div>
            <div class="table-responsive">
                <div class="dataTables_wrapper" role="grid">
                    <table class="table table-striped table-bordered table-hover dataTable">
                        <thead>
                        <tr role="row">
                            <th>任务ID</th>
                            <th>任务名称</th>
                            <th>任务周期</th>
                            <th>偏移量</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="dependenceTask in dependenceTasks">
                            <td>{{dependenceTask.taskId}}</td>
                            <td>{{dependenceTask.taskName}}</td>
                            <!--<td>{{dependenceTask.cycle}}</td>-->
                            <!--<td>{{dependenceTask.cycleGap}}</td>-->
                            <td>
                                <span class="label {{getExecutionCycleLabel(dependenceTask.cycle)}}">
                                    {{getCycleText(dependenceTask.cycle)}}
                                </span>
                            </td>
                            <td>
                                <select class="width-80"  ng-model="dependenceTasks[$index].offset"
                                        ng-options="offset for offset in {{getOffsetOptions(dependenceTask.cycle)}}">
                                </select>
                            </td>
                            <!--<td>-->
                            <!--<span class="label {{getExecutionCycleLabel(dependenceTask.cycle)}}">{{getCycleText(dependenceTask.cycle)}}-->
                            <!--</span>-->
                            <!--</td>-->
                            <!--<td>-->
                            <!--<select class="width-80" name="taskPeriod" ng-model="dependenceTasks[$index].cycleGap"-->
                            <!--ng-options="offset for offset in {{getOffsetOptions(dependenceTask.cycle)}}"></select>-->
                            <!--</select>-->
                            <!--</td>-->
                            <td>
                                <button class="btn-link ng-scope"
                                        ng-click="deleteDependenceTask($index)"
                                        tooltip-placement="top" tooltip="删除依赖">
                                    <i class="icon-remove bigger-150"></i>
                                </button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div class="row" id="addDependencyButton">
                        <button class="btn-link ng-scope" ng-click="showDependenceDialog()"
                                tooltip-placement="top"
                                tooltip="添加依赖">
                            <i class="icon-plus bigger-180"></i>
                        </button>
                    </div>
                    <div class="col-sm-12">
                        <p class="text-right">
                            <button class="btn btn-lg btn-success" ng-click="submitTaskConfig()"
                                    ng-disabled="taskConfSave">保存
                            </button>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

